﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ADA.Business;
using ADA.Entity;
using System.IO;

namespace ADA.Presentation.PRL.MarketNews
{
    public partial class ShowMarketNewsForm : Form
    {
        int newsID;
        MainForm main;
        public ShowMarketNewsForm(MainForm Main, int NewsID)
        {
            newsID = NewsID;
            main = Main;
            InitializeComponent();
        }

        private void ShowMarketNewsForm_Load(object sender, EventArgs e)
        {
            string message;
            News news;
            BOLNews bolNews = new BOLNews();
            if (bolNews.getNewsInfo(newsID, out news, out message) == true)
            {
                lblTitle.Text = news.Title.ToString().Trim();
                lblTitleJP.Text = news.TitleJP.ToString().Trim();
                img.ImageLocation = Common.URL_NEWS + Path.GetFileName(news.Image.ToString().Trim());
                tbxContent.Text = news.Content.ToString().Trim();
                tbxContentJP.Text = news.ContentJP.ToString().Trim();
            }
            else
            {
                MessageBox.Show(message);
            }
        }

        private void btnEdit_Click(object sender, EventArgs e)
        {
            this.Hide();
            main.btnEditNews_Click(sender, e);
            this.Close();
        }

        private void btnDelete_Click(object sender, EventArgs e)
        {
            this.Hide();
            main.btnDeleteNews_Click(sender, e);
            this.Close();
        }
    }
}
